package coroutine

import (
	"fmt"
	"time"
)

// Coroutine 协程非阻塞
func Coroutine() {
	startTime := time.Now()
	go func(name string) {
		time.Sleep(2 * time.Second)
		fmt.Printf("我是%s,李四在等我!\n", name)
	}("张三")
	go func(name string) {
		time.Sleep(2 * time.Second)
		fmt.Printf("我是%s,我在等张三!\n", name)
	}("李四")
	fmt.Println("program perform times:", time.Since(startTime))
	for {
		time.Sleep(2 * time.Second)
		fmt.Println("我是主线程我永远不会退出!")
	}
}
